#ifndef _COMM_H_
#define _COMM_H_

#include "rudp.h"   // Rudp, RudpPackage
#include "stddef.h" // size_t

// global macros
#define g_serv_port 3333        // server port
#define g_buff_size (0x7fffu-4) // buff size

// For functions, distinguish calls from server/client
#define CALL_BY_CLIENT 1
#define CALL_BY_SERVER 0

void dump(RudpPackage *p);
void dump_recv(Rudp *U);
void print_hex(char *readbuf, int nread);

size_t udp_send(RudpPackage *p, bool called_by_client);
size_t udp_recv(bool called_by_client);

void socket_init(bool called_by_client, int port);
void socket_close();

#endif
